class DemoTs{
    name:string;
    age:number;
    constructor(name:string,age:number){
        this.name = name;
        this.age = age;
    }
    getInfo():string{
        return `姓名:${this.name} 年龄:${this.age}`;
    }
}

let dts = new DemoTs('小官',18);

let msg = dts.getInfo();

console.log(msg);
